package com.kris;

import java.util.Comparator;

/**
 * 按照日期进行排序，也就是员工的统计表报表中按照员工的上班日期进行排序
 *
 * @author zhangqunshi
 */
public class EmployeeWorkTimeComparator implements Comparator {

    @Override
    public int compare(Object o1, Object o2) {
        if (o1 != null && o2 != null) {
            EmployeeWorkTime e1 = (EmployeeWorkTime) o1;
            EmployeeWorkTime e2 = (EmployeeWorkTime) o2;
            if (e1.getBeginTime() != null
                    && e2.getBeginTime() != null
                    && e1.getBeginTime().after(e2.getBeginTime())) {
                return 1;
            }
        }
        return -1;

    }

}
